export default {
  data() {
    return {
      swiperList: [],

      swiperOption: {
        effect: 'fade',
        loop: true,
        allowSlideNext: false,
        allowSlidePrev: false,
      },

      swiperOptionThumbs: {
        spaceBetween: 10,
        touchRatio: 0.2,
        centeredSlides: true,
        slidesPerView: 3,
        loop: true,
        loopedSlides: 3, //looped slides should be the same
        slideToClickedSlide: true,
        autoplay: {
          delay: 4900,
          disableOnInteraction: false,
        }
      },
    };
  },

  computed: {
    cSwiperList() {
      return _.map(this.swiperList, (info) => {
        return {
          ...info,
          ...{
            image: `background-image:url(${info.image})`,
            smallImage: `background-image:url(${info.smallImage ? info.smallImage : info.image})`,
            actionUrl: info.actionUrl,
          }
        };
      });
    }
  },

  methods: {
    defaultSwiperResponseFunc() {
      return {
        format: (data) => {
          if (!_.isEmpty(data)) {
            return data;
          } else {
            return this.defaultSwiper;
          }
        },
        afterFail: () => {
          this.swiperList = this.defaultSwiper;
        }
      };
    }
  }
};
